#pragma once

#include "api/TimingEngine.hh"
#include "api/TimingIDBAdapter.hh"
#include "../io/DbInterface.h"

namespace ieda_contest {

// #define MULTIPATH

using VertexSet = std::set<ista::StaVertex *>;
using VertexSeq = std::vector<ista::StaVertex *>;
using Slack = double;
using namespace ista;
// const float kInf = 1E+30F;
class PathNet
{
public:
    PathNet() = default;
    ~PathNet() = default;
    PathNet(ista::TimingEngine* timing) : _timing_engine(timing) {}
    void doGateSizing();

private:
    Slack getWorstSlack(StaVertex *vertex, AnalysisMode mode);
    VertexSeq findViolationNode();

    void optimize(StaVertex *vertex);

    bool repowerInstance(Instance *inst, LibertyCell *replace);

    ista::TimingEngine* _timing_engine = nullptr;
};
} // namespace ieda_contest